package com.ruoyi.project.oms.paeaAuPoint.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.oms.paeaAuPoint.domain.PaeaAuPoint;
import com.ruoyi.project.oms.paeaAuPoint.mapper.PaeaAuPointMapper;
import com.ruoyi.project.oms.paeaAuPoint.service.IPaeaAuPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 监督点定义Service业务层处理
 *
 * @author 关晓强
 * @date 2020-03-14
 */
@Service
public class PaeaAuPointServiceImpl extends ServiceImpl<PaeaAuPointMapper, PaeaAuPoint> implements IPaeaAuPointService
{
    @Autowired
    private PaeaAuPointMapper paeaAuPointMapper;

    /**
     * 查询监督点定义
     *
     * @param id 监督点定义ID
     * @return 监督点定义
     */
    @Override
    public PaeaAuPoint selectPaeaAuPointById(String id)
    {
        return paeaAuPointMapper.selectPaeaAuPointById(id);
    }

    /**
     * 查询监督点定义列表
     *
     * @param paeaAuPoint 监督点定义
     * @return 监督点定义
     */
    @Override
    public List<PaeaAuPoint> selectPaeaAuPointList(PaeaAuPoint paeaAuPoint)
    {
        return paeaAuPointMapper.selectPaeaAuPointList(paeaAuPoint);
    }

    /**
     * 新增监督点定义
     *
     * @param paeaAuPoint 监督点定义
     * @return 结果
     */
    @Override
    public int insertPaeaAuPoint(PaeaAuPoint paeaAuPoint)
    {
        paeaAuPoint.setCreateTime(DateUtils.getNowDate());
        return paeaAuPointMapper.insertPaeaAuPoint(paeaAuPoint);
    }

    /**
     * 修改监督点定义
     *
     * @param paeaAuPoint 监督点定义
     * @return 结果
     */
    @Override
    public int updatePaeaAuPoint(PaeaAuPoint paeaAuPoint)
    {
        paeaAuPoint.setUpdateTime(DateUtils.getNowDate());
        return paeaAuPointMapper.updatePaeaAuPoint(paeaAuPoint);
    }

    /**
     * 删除监督点定义对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePaeaAuPointByIds(String ids)
    {
        return paeaAuPointMapper.deletePaeaAuPointByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除监督点定义信息
     *
     * @param id 监督点定义ID
     * @return 结果
     */
    @Override
    public int deletePaeaAuPointById(String id)
    {
        return paeaAuPointMapper.deletePaeaAuPointById(id);
    }

    /**
     * 通过监督Id 查询 监督点
     * @param itemId
     * @return 监督点集合
     */
    public List<PaeaAuPoint> queryPaeaAuPointsByAuditItem(String itemId){
        return paeaAuPointMapper.queryPaeaAuPointsByAuditItem(itemId);
    }
}
